package fju.im.internetnews;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SQLiteActivity extends Activity {
	SQLiteDatabase db;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sqlite);
		
		 final EditText db_name = (EditText) findViewById(R.id.database_name); 
		
		Button create_database = (Button) findViewById(R.id.create_database);
		create_database.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				db = openOrCreateDatabase(db_name.getText().toString(), Context.MODE_PRIVATE,null);
				new SQLiteActivity();
			}
		});
		
		Button delete_database = (Button) findViewById(R.id.delete_database);
		delete_database.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v){
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.sqlite, menu);
		return true;
	}

}
